package com.ctgu.chatapp.view.fragment.MainFragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.ctgu.chatapp.databinding.CardViewBinding
import com.ctgu.chatapp.view.DialogFragment.CardViewDialog
import com.ctgu.chatapp.viewModel.MainViewModel

class CardView : Fragment() {

    val viewModel by lazy { ViewModelProvider(requireActivity())[MainViewModel::class.java] }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        val binding = CardViewBinding.inflate(inflater, container, false)
        binding.viewModel = viewModel
        binding.lifecycleOwner = requireActivity()
        val dialog = CardViewDialog()
        dialog.show(parentFragmentManager, "dialog")
        return binding.root
    }
}